<?php 
require "DataLoad.php"; 
?>
<!DOCTYPE html PUBLIC "-//W3C//Dth XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/Dth/xhtml1-transitional.dth">

<html>
<head>
<title><?php echo $GuildName;?> - DKP系统</title>
<script language="JavaScript" src="inc/jquery.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="Generator" content="EditPlus">
<meta name="Author" content="SULei">
<meta name="Keywords" content="DKP WOW GUILD">
<meta name="Description" content="">
<link href="<?php echo $StylePath;?>/main.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="<?php echo $StylePath;?>/styleplus.js"></script>
<style type="text/css" media="all">

</style>
<!--#include file="inc/ajax.php"-->
</head>


<?php 
if (Checkadmin()) {
	switch ($_REQUEST["action"]) {
		case "delkilled":
			dbDelKilledMark($_REQUEST["sn"]);
			break;
		case "addkilled":
			dbAddKilledMark($_REQUEST["sn"]);
			break;
	}

}



?>

<body>
<div class="header">
<?php require "menu.php"; ?>
</div>
<div class="main">

<div class="timeChart outframe">
	<h3>Wotlk首领进度</h3>
<?php 
$sql="select * from Instance where killed = True";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
	$strKilledSNList=$strKilledSNList.",".$row["SN"];
}

//response.write strKilledSNList

foreach ($iInstance as $Iindex => $inst) {
	if (is_array($inst)) {
		print "	<h4>".$inst[$langcode]."</h4>";
		foreach ($iBoss[$Iindex] as $Bindex => $boss) {
			if (is_array($iBoss[$Iindex][$Bindex])) {
				if (CheckAdmin()) {
					if ((strpos($strKilledSNList.",",",".$Iindex.$Bindex.",") ? strpos($strKilledSNList.",",",".$Iindex.$Bindex.",")+1 : 0)!=0) {
						print "<div class='boss'><img src='images/Boss/".$iBoss[$Iindex][$Bindex][3].".gif' alt='' /><b>".$iBoss[$Iindex][$Bindex][$langcode]."</b><span><a href='?action=delkilled&amp;sn=".$iBoss[$Iindex][$Bindex][3]."'>撤销</a></span></div>";
					}else{
						print "<div class='boss unkilled'><img src='images/Boss/".$iBoss[$Iindex][$Bindex][3].".gif' alt='' /><b>".$iBoss[$Iindex][$Bindex][$langcode]."</b><span><a href='?action=addkilled&amp;sn=".$iBoss[$Iindex][$Bindex][3]."'>击杀</a></span></div>";
					} 
				}else{
					if ((strpos($strKilledSNList.",",",".$Iindex.$Bindex.",") ? strpos($strKilledSNList.",",",".$Iindex.$Bindex.",")+1 : 0)!=0) {
						print "<div class='boss'><img src='images/Boss/".$iBoss[$Iindex][$Bindex][3].".gif' alt='' /><b>".$iBoss[$Iindex][$Bindex][$langcode]."</b></div>";
					}else{
						print "<div class='boss unkilled'><img src='images/Boss/".$iBoss[$Iindex][$Bindex][3].".gif' alt='' /><b>".$iBoss[$Iindex][$Bindex][$langcode]."</b></div>";
					} 
				} 
			} 
		}
	} 
}

?>
</div>

</div>
<?php require "footer.php"; ?>
</body>
</html>

<?php 

function dbAddKilledMark($sn) {
	mysql_query("INSERT INTO Instance (killed,SN) Values (True,".$sn.")");
	return;
} 

function dbDelKilledMark($sn) {
	echo "Delete * from Instance where SN=".$sn;
	mysql_query("Delete from Instance where SN=".$sn) or die(mysql_error());
	return;
} 

?>
